<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head lang="en">
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<%@include file="style.jsp" %>
    <%@include file="script.jsp" %>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/orderlang/distributor/css/customer_audit.css"/>
    <script type="text/javascript">
    	function submitForm(){
    		document.getElementById("customerName").submit();
    	}
    </script>
    <title>客户申请</title>
</head>
<body onselectstart="return false">
	<div id="container_1" style="height:100%">
	    <div style="position: relative">
	        <%@include file="header.jsp" %>
	    </div>
	    <div id="content" class="clearfix">
	        <%@include file="left_menu.jsp" %>
	        <!--内容部分-->
	        <div class="right-content" style="margin:75px 50px 0 213px;">
	            <p class="brand">
	                <a>客户</a>><a class="now">客户申请</a>
	            </p>
	            <div class="content">
	                <div class="top-block">
	                    <div class="search-box fl">
	                    	<form action="${pageContext.request.contextPath}/customerApply/getCustomerApplyByName" method="post" id="customerName">
	                        <input type="text" name="customerName" placeholder="请输入客户"/>
	                        <span onclick="submitForm()"></span>
	                        </form>
	                    </div>
	                </div>
	                <div class="customer-list">
	                    <table>
	                        <thead>
	                            <tr>
	                                <td></td>
	                                <td>客户</td>
	                                <td>登录账号</td>
	                                <td>归属地区</td>
	                                <td>联系人</td>
	                                <td>联系方式</td>
	                                <td>申请时间</td>
	                                <td>备注</td>
	                                <td>是否同意</td>
	                                <td>操作</td>
	                            </tr>
	                        </thead>
	                        <tbody>
	                        	<c:forEach items="${customerApplyList}" var="caList" varStatus="i">
		                            <tr>
		                                <td>${i.index+1}</td>
		                                <td>${caList.customer.name}</td>
		                                <td>${caList.customer.systemName}</td>
		                                <c:forEach items="${addressList}" var="address" begin="${i.index}" end="${i.index}">
		                                <td>${address}</td>
		                                </c:forEach>
		                                <td>${caList.customer.contact}</td>
		                                <td>${caList.customer.tel}</td>
		                                <td><fmt:formatDate value="${caList.applyTime}" pattern="yyyy-MM-dd hh:mm"/></td>
		                                <td>${caList.applyContent}</td>
		                                <td>
		                                	<c:if test="${caList.isPass == 1}" >同意</c:if>
		                                	<c:if test="${caList.isPass == 2}" >不同意</c:if>
		                                </td>
		                                <td>
		                                	<c:if test="${caList.isPass == 0}">
			                                	<button class="agree"><a href="${pageContext.request.contextPath}/customerApply/updateCustomerApply?isPass=1&id=${caList.id}">同意</a></button>
		                                    	<button class="disagree"><a href="${pageContext.request.contextPath}/customerApply/updateCustomerApply?isPass=2&id=${caList.id}">不同意</a></button>
	                                    	</c:if>
		                                </td>
		                            </tr>
	                            </c:forEach>
	                        </tbody>
	                    </table>
	                </div>
	            </div>
	        </div>
	        <script src="${pageContext.request.contextPath}/static/orderlang/distributor/js/customer_audit.js"></script>
	        <!--内容部分结束-->
	    </div>
	</div>

</body>
</html>